def cheakid():
    username = input("请输入用户名：")
    if len(username)== 0 and len(username)>8:
        print("用户名长度不能为空且不能超过8位")
        cheakid()
    if username.isalnum() == False:
        print("用户名只能由数字、字母、下划线组成")
        cheakid()
    else:print("用户名格式正确,用户名为：{}".format(username))
    return username


def cheakemail():
    useremail = input("请输入注册邮箱：")
    if useremail.find('@') == -1 or useremail.find('@') == 0 or useremail.find('@') == len(useremail)-1:
        print("邮箱格式错误")
        cheakemail()
    else:print("邮箱格式正确,邮箱为：{}".format(useremail))
    return useremail


def cheaksfz():
    usersfz = input("请输入身份证号")
    if len(usersfz)!= 18:
        print("身份证号格式不正确")
        cheaksfz()
    sfz_sex=usersfz[14:17]
    if int(sfz_sex)%2==0:
        print("身份证格式正确，身份证号为：{}性别为女".format(usersfz))
    else:print("身份证格式正确，身份证号为：{}性别为男".format(usersfz))
    return usersfz


def cheakname():
    userxm = input("请输入姓名：")
    if isChinese(userxm)==False:
        print("姓名只能为中文")
        cheakname()
    if len(userxm)==0 or len(userxm)>8:
        print("姓名长度不能超过四位")
        cheakname()
    else:print("姓名格式正确，姓名为：{}".format(userxm))
    return userxm



def isChinese(word):
    for xm in word:
        if '\u4e00' <= xm <= '\u9fff':
            return True
    return False

print("用户名：",cheakid(),"邮箱：",cheakemail(),"身份证：",cheaksfz(),"姓名：",cheakname())
